
#include "Component.h"

using namespace observer;

Component::Component(Publisher * publisher) : _publisher(publisher) { }

void Component::add_event_observer(Observer * o)
{
  _publisher->AddObserver(o);
}

void Component::del_event_observer(Observer * o)
{
  _publisher->DelObserver(o);
}

void Component::notify(Event * e)
{
  _publisher->Publish(e);
}

Component::~Component()
{
    delete _publisher;
    _publisher = nullptr;
}
